<%@page import="edu.boun.cmpe.elele.cotrans.dbOperations.*" %>
<%@page import="java.util.ArrayList" %>
<%@page import="java.util.Iterator" %>
<%@page import="reader.TransFileReader" %>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<%
    String transID=request.getParameter("transID");
    String userID=session.getAttribute("userid").toString();
    //String userID="2";
    //String transID="1";
    DbOperations db= new DbOperations();
    ArrayList<String> array= db.getTransDoc(transID);
    String transPath= array.get(0);
    String origPath= array.get(1);

    TransFileReader t= new TransFileReader();

    String transContent=t.readPath(transPath);
    String origContent=t.readPath(origPath);

%>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <script language="JavaScript" src="js/jquery.js"></script>
<script language="JavaScript" src="js/jquery.wysiwyg.js"></script>
<script language="JavaScript" src="js/functions.js"></script>
<script language="JavaScript" src="js/jquery.sundaymorning.js"></script>
<script language="JavaScript" src="js/autoresize.jquery.js"></script>
<script language="JavaScript" src="rating/jquery.rating.pack.js"></script>
<script language="JavaScript" src="rating/jquery.MetaData.js"></script>

<link rel="stylesheet" href="rating/jquery.rating.css" type="text/css">
<link rel="stylesheet" href="css/jquery.wysiwyg.css" type="text/css">
        <script language="javascript">
$(document).ready(function() {
		$('#translated').wysiwyg({

		controls : {
		separator04 : { visible : true },
		insertOrderedList : { visible : true },
		strikeThrough : { visible : true },
		underline : { visible : true },
		insertUnorderedList : { visible : true }
		}
		});


		$('#original').wysiwyg({
			controls : {
			separator04 : { visible : true },
			insertOrderedList : { visible : true },
			strikeThrough : { visible : true },
			underline : { visible : true },
			insertUnorderedList : { visible : true }
			}
		});


$('#dict .dic').sundayMorningReset();
		$('#dict .dic input[type=button]').click(function(evt) {
			$.sundayMorning(
				$('#dict textarea').val(),
				{ destination:'tr', menuLeft:evt.pageX, menuTop:evt.pageY},
				function(response) {
					$('#dict textarea').val(response.translation);
				}
			);
		});

		$('#dict textarea').autoResize({
		    // On resize:
		    onResize : function() {
		        $(this).css({opacity:0.8});
		    },
		    // After resize:
		    animateCallback : function() {
		        $(this).css({opacity:1});
		    },
		    // Quite slow animation:
		    animateDuration : 300,
		    // More extra space:
		    extraSpace : 40
		});

})
</script>
    </head>
    <body>
        <table>
            <tr>
               <td><div class="Clear">

                        <input class="star" type="radio" name="test1rating4" value="1" title="Worst"/>
                        <input class="star" type="radio" name="test1rating4" value="2" title="Bad"/>
                        <input class="star" type="radio" name="test1rating4" value="3" title="OK"/>
                        <input class="star" type="radio" name="test1rating4" value="4" title="Good"/>
                        <input class="star" type="radio" name="test1rating4" value="5" title="Best"/>
                        <input type="button" onclick="getRating()" value="Rate Translation">
                        </div>
                </td>
              <td>
                <div >
                Dictionary en -> tr :<div id="dict"><p class="dic">
                <textarea cols="50" rows="1">Enter word or phrase to translate</textarea>
                <input type="button" value="translate" />
                </p>
                </div>
                </div>
                <br>
            </td>

            </tr>
                 <tr>
                <td>

                     <textarea id="original" cols="%80" rows="%60" name="original" readonly="readonly">
                    <%=origContent%>
                    </textarea>


                </td>
                <td>
                  
                 <textarea id="translated" cols="%80" rows="%60" name="translated" readonly="readonly">
                  <%=transContent%>

                </textarea>
                </td>
            </tr>
            
</table>
<input type="hidden" id="transID" value="<%=transID%>">
    </body>
</html>
